import Vue from 'vue';
import VueRouter from 'vue-router';
import Login from '../views/Login.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/login',
    name: 'login',
    component: Login,
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue'),
  },
  {
    path: '/welcome',
    name: 'welcome',
    component: () => import('../views/Welcome.vue'),
    meta: {
      title: '欢迎体验vue2全栈课程',
    },
    children: [
      {
        path: '/system/user',
        name: 'system/user',
        component: () => import('../views/system/user.vue'),
        meta: {
          title: '用户管理',
        },
      }, {
        path: '/system/menu',
        name: 'system/menu',
        component: () => import('../views/system/menu.vue'),
        meta: {
          title: '菜单管理',
        },
      }, {
        path: '/system/role',
        name: 'system/role',
        component: () => import('../views/system/role.vue'),
        meta: {
          title: '角色管理',
        },
      }, {
        path: '/system/dept',
        name: 'system/dept',
        component: () => import('../views/system/dept.vue'),
        meta: {
          title: '部门管理',
        },
      }, {
        path: '/audit/approve',
        name: 'audit/approve',
        component: () => import('../views/audit/approve.vue'),
        meta: {
          title: '待审批',
        },
      }, {
        path: '/audit/leave',
        name: 'audit/leave',
        component: () => import('../views/audit/leave.vue'),
        meta: {
          title: '休假申请',
        },
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
